<cfcomponent extends="assets.calgrants.com.Base">

	<cfscript>
        import assets.calgrants.com.bo.FundWorkshop;
	</cfscript>
	
	<cffunction name="get" access="public" output="false" returntype="assets.calgrants.com.bo.FundWorkshop">
		<cfargument name="Fund_Workshop_ID" type="numeric" required="true" />
		<cfscript>
			if (arguments.Fund_Workshop_ID gt 0) {
				local.loadArgs = {};
				local.loadArgs.obj = new FundWorkshop();
				StructAppend(local.loadArgs, QueryToStruct(read(argumentCollection = arguments))[1]);
				return load(argumentCollection = local.loadArgs);
			} else {
				return new FundWorkshop();
			}
		</cfscript>
	</cffunction>
		
	<cffunction name="load" access="public" output="false" returntype="assets.calgrants.com.bo.FundWorkshop">
		<cfargument name="obj" type="assets.calgrants.com.bo.FundWorkshop" required="true" />
		<cfscript>
			local.obj = arguments.obj;
			if (IsDefined("arguments.Fund_Workshop_ID")) {
				local.obj.setFund_Workshop_ID(arguments.Fund_Workshop_ID);
			}
			if (IsDefined("arguments.Deleted")) {
				local.obj.setDeleted(arguments.Deleted);
			}
			if (IsDefined("arguments.Fund_ID")) {
				local.obj.setFund_ID(arguments.Fund_ID); 
			}
			if (IsDefined("arguments.Workshop_ID")) {
				local.obj.setWorkshop_ID(arguments.Workshop_ID);
			}
			if (IsDefined("arguments.Student_Count")) {
				local.obj.setStudent_Count(arguments.Student_Count);
			}
			if (IsDefined("arguments.Parent_Count")) {
				local.obj.setParent_Count(arguments.Parent_Count);
			}
			if (IsDefined("arguments.Volunteer_Count")) {
				local.obj.setVolunteer_Count(arguments.Volunteer_Count);
			}
			if (IsDefined("arguments.Computer_Count")) {                             
				local.obj.setComputer_Count(arguments.Computer_Count);
			}
			if (IsDefined("arguments.Fund_Amount")) {
				local.obj.setFund_Amount(arguments.Fund_Amount);
			}
			if (IsDefined("arguments.Financial_Aid_Presentation")) {
				local.obj.setFinancial_Aid_Presentation(arguments.Financial_Aid_Presentation);
			}
			if (IsDefined("arguments.FAFSA_On_The_Web")) {
				local.obj.setFAFSA_On_The_Web(arguments.FAFSA_On_The_Web);
			}
			if (IsDefined("arguments.Online")) {
				local.obj.setOnline(arguments.Online);
			}
			if (IsDefined("arguments.Small_Group")) {
				local.obj.setSmall_Group(arguments.Small_Group);
			}
			if (IsDefined("arguments.AB540")) {
				local.obj.setAB540(arguments.AB540);
			}
			if (IsDefined("arguments.Date_Created")) {
				local.obj.setDate_Created(arguments.Date_Created);
			}
			return local.obj;
		</cfscript>
	</cffunction>

	<cffunction name="read" access="public" output="false" returntype="any">
		<cfargument name="Fund_Workshop_ID" required="false" default="" />
		<cfargument name="Deleted" required="false" default="0" />
		<cfargument name="Fund_ID" required="false" default="" />
		<cfargument name="Workshop_ID" required="false" default="" />
		<cfargument name="Student_Count" required="false" default="" />
		<cfargument name="Parent_Count" required="false" default="" />
		<cfargument name="Volunteer_Count" required="false" default="" />
		<cfargument name="Computer_Count" required="false" default="" />
		<cfargument name="Fund_Amount" required="false" default="" />
		<cfargument name="Financial_Aid_Presentation" required="false" default="" />
		<cfargument name="FAFSA_On_The_Web" required="false" default="" />
		<cfargument name="Online" required="false" default="" />
		<cfargument name="Small_Group" required="false" default="" />
		<cfargument name="AB540" required="false" default="" />
		<cfargument name="Date_Created" required="false" default="" />
		<cfargument name="fundIDs" required="false" default="" />
		<cfset var recs = "">
		<cfstoredproc datasource="#getDatasource()#" procedure="readFundWorkshop">
			<cfprocparam value="#arguments.Fund_Workshop_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Fund_Workshop_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Deleted#" cfsqltype="CF_SQL_BIT" null="#IIf(Len(Trim(arguments.Deleted)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Fund_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Fund_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Workshop_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Workshop_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Student_Count#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Student_Count)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Parent_Count#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Parent_Count)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Volunteer_Count#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Volunteer_Count)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Computer_Count#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Computer_Count)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Fund_Amount#" cfsqltype="CF_SQL_MONEY" null="#IIf(Len(Trim(arguments.Fund_Amount)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Financial_Aid_Presentation#" cfsqltype="CF_SQL_BIT" null="#IIf(NOT IsBoolean(arguments.Financial_Aid_Presentation), true, false)#" />
			<cfprocparam value="#arguments.FAFSA_On_The_Web#" cfsqltype="CF_SQL_BIT" null="#IIf(NOT IsBoolean(arguments.FAFSA_On_The_Web), true, false)#" />
			<cfprocparam value="#arguments.Online#" cfsqltype="CF_SQL_BIT" null="#IIf(NOT IsBoolean(arguments.Online), true, false)#" />
			<cfprocparam value="#arguments.Small_Group#" cfsqltype="CF_SQL_BIT" null="#IIf(NOT IsBoolean(arguments.Small_Group), true, false)#" />
			<cfprocparam value="#arguments.AB540#" cfsqltype="CF_SQL_BIT" null="#IIf(NOT IsBoolean(arguments.AB540), true, false)#" />
			<cfprocparam value="#arguments.Date_Created#" cfsqltype="CF_SQL_TIMESTAMP" null="#IIf(Len(Trim(arguments.Date_Created)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.fundIDs#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.fundIDs)) eq 0, true, false)#" />
			<cfprocresult name="recs" />
		</cfstoredproc>
		<cfreturn recs />
	</cffunction>
	
		<cffunction name="save" access="public" output="false" returntype="any">
		<cfargument name="fundWorkshop" required="true" type="assets.calgrants.com.bo.FundWorkshop" />
		<cfstoredproc datasource="#getDatasource()#" procedure="saveFundWorkshop">
			<cfprocparam value="#fundWorkshop.getFund_Workshop_ID()#" cfsqltype="CF_SQL_INTEGER" variable="id" type="inout" null="false" />
			<cfprocparam value="#fundWorkshop.getDeleted()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshop.getFund_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getWorkshop_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getStudent_Count()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getParent_Count()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getVolunteer_Count()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getComputer_Count()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getFund_Amount()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshop.getFinancial_Aid_Presentation()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshop.getFAFSA_On_The_Web()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshop.getOnline()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshop.getSmall_Group()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshop.getAB540()#" cfsqltype="CF_SQL_BIT" null="false" />
		</cfstoredproc>
		<cfreturn id />
	</cffunction>

	<cffunction name="destroy" access="public" output="false" returntype="any">
		<cfargument name="Fund_Workshop_ID" required="true" />
		<cfstoredproc datasource="#getDatasource()#" procedure="destroyFundWorkshop">
			<cfprocparam value="#arguments.Fund_Workshop_ID#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="true" cfsqltype="CF_SQL_BIT" null="false" />
		</cfstoredproc>
		<cfreturn true />
	</cffunction>

</cfcomponent>

